﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CostAccounting.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <!--#include virtual="include/Head.ascx"-->
    <link rel="stylesheet" href="Assets/css/EditTableCell.css" type="text/css" />
    <script type='text/javascript' src="Assets/js/jquery-custom-1.0.0.js?v=2011"></script>
    <link rel="stylesheet" type="text/css" href="assets/css/datepicker.css" />
    <script type='text/javascript' src="assets/js/jquery.ui.datepicker.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#txtFrom").datepicker({ dateFormat: "dd-mm-yy" });
            $("#txtTo").datepicker({ dateFormat: "dd-mm-yy" });
            $("#btnExport").click(function () {
                openwindow();
            });
        });
        function getUrlVars() {
            var vars = {};
            var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) {
                vars[key] = value;
            });
            return vars;
        }
        function doDelete(strID, strName) {
            if (confirm('Bạn có thực sự muốn xóa ' + strName + '?')) {
                var vnpage = getUrlVars()['page_number'];
                var vChar = getUrlVars()['letter'];
                var strHref = "";
                if (vnpage)
                    strHref = "CostAccounting.aspx?action=delete&ID=" + strID + "&page_number=" + vnpage;
                else
                    strHref = "CostAccounting.aspx?action=delete&ID=" + strID;

                if (vChar)
                    window.location.href = strHref + "&letter=" + vChar;
                else
                    window.location.href = strHref;
            }
        }
        function doEdit(strID, strFileNo) {
            var vnpage = getUrlVars()['page_number'];
            if (vnpage)
                url = "CostAccounting.Edit.aspx?id=" + strID + "&page_number=" + vnpage;
            else
                url = "CostAccounting.Edit.aspx?id=" + strID;
            window.location.href = url;
            //var win=window.open(url, '_blank');
            //win.focus();
        }
        function doCopy(strID, strFileNo) {
            var vnpage = getUrlVars()['page_number'];
            if (vnpage)
                url = "CostAccounting.aspx?action=copy&id=" + strID + "&FileNumber=" + strFileNo + "&page_number=" + vnpage;
            else
                url = "CostAccounting.aspx?action=copy&id=" + strID + "&FileNumber=" + strFileNo;
            window.location.href = url;
            //var win=window.open(url, '_blank');
            //win.focus();
        }
        function openwindow() {
            window.open("./CostAccounting.Export.aspx?action=export", "mywindow", "menubar=0,status=0,directories=0,resizable=1,scrollbars=1,width=720,height=500");
        }       
    </script>
    <style type="text/css">
        .bottom td
        {
            font-weight: bold;
            text-align: right;
        }
    </style>
</head>
<body>
    <div id="body-wrapper">
        <div id="header">
            <!--#include virtual="include/top.ascx"-->
        </div>
        <div id="main-content1">
            <h2>
                COSTING SUM:
                <%=Province %>
            </h2>
            <div class="clear">
            </div>
            <div class="content-box">
                <form id="frmEdit" runat="server">
                <div class="content-box-header">
                    <h3 style="cursor: s-resize;">
                        LIST OF
                        <% =Province%>
                    </h3>
                    <%if(nPermissions>7){ %>
                    <asp:DropDownList ID="ddProvince" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddProvince_SelectedIndexChanged">
                    </asp:DropDownList>
                    <%} %>
                    Find:
                    <asp:TextBox ID="keyword" Text="" runat="server"></asp:TextBox>
                    By:
                    <asp:DropDownList ID="ddType" runat="server">
                        <asp:ListItem Text="File Number" Value="1"></asp:ListItem>
                        <asp:ListItem Text="Carrier" Value="2"></asp:ListItem>
                        <asp:ListItem Text="Customer" Value="3"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:TextBox ID="txtFrom" CssClass="calendar-icon" runat="server" value="From" onclick="if(this.value=='From'){this.value=''; this.style.color='#000'}"
                        onblur="if(this.value==''){this.value='From'; this.style.color='#555'}" Width="125px"></asp:TextBox>
                    <asp:TextBox ID="txtTo" CssClass="calendar-icon" runat="server" value="To" Width="125px"
                        onclick="if(this.value=='To'){this.value=''; this.style.color='#000'}" onblur="if(this.value==''){this.value='To'; this.style.color='#555'}"></asp:TextBox>
                    <asp:Button ID="btnSearch" Text="Search" runat="server" CssClass="button" Style="margin: 9px 10px;"
                        OnClick="btnSearch_Click" />
                    <%if(nPermissions>=7){ %>
                    <input id="btnAddNew" type="button" style="float: right; margin: 9px 10px;" class="button"
                        value="Add new" onclick="window.location.href='CostAccounting.Edit.aspx'" />
                    <%} %>
                    <%if(nPermissions>7){ %>
                    <input id="btnExport" type="button" style="float: right; margin: 9px 5px;" class="button"
                        value="&nbsp;Export&nbsp;" />
                    <asp:Button ID="btnCloseAllFile" Style="float: right; margin: 9px 5px; color: red !important;"
                        CssClass="button" runat="server" Text="&nbsp;Close All&nbsp;" OnClick="btnCloseAllFile_Click" />
                    <asp:Button ID="btnCloseFile" Style="float: right; margin: 9px 5px;" CssClass="button"
                        runat="server" Text="&nbsp;Close&nbsp;" OnClick="btnCloseFile_Click" />
                    <%} %>
                    <div class="clear">
                    </div>
                </div>
                <asp:Repeater ID="rptData" runat="server">
                    <ItemTemplate>
                        <tr onmouseover="this.style.background='#dbf0c9'" onmouseout="this.style.background='#ffffff'"
                            borrowbookid='<%#Eval("ID") %>'>
                            <td>
                                <%# DataBinder.Eval(Container.DataItem, "Index")%>
                            </td>
                            <td editable="false" code="FileNumber" completesource="vFileNumber">
                                <%# DataBinder.Eval(Container.DataItem, "FileNumber")%>
                            </td>
                            <td editable="false" code="Agent">
                                <%# DataBinder.Eval(Container.DataItem, "Agent")%>
                            </td>
                            <td editable="false" code="Customer">
                                <%# DataBinder.Eval(Container.DataItem, "Customer")%>
                            </td>
                            <%-- <td editable="false" code="POL">
                                <%# DataBinder.Eval(Container.DataItem, "POL")%>
                            </td>--%>
                            <td editable="false" code="POD">
                                <%# DataBinder.Eval(Container.DataItem, "POD")%>
                            </td>
                            <td editable="false" code="ETD">
                                <%# DataBinder.Eval(Container.DataItem, "ETD")%>
                            </td>
                            <td editable="false" code="MBLNo">
                                <%# DataBinder.Eval(Container.DataItem, "MBLNo")%>
                            </td>
                            <td editable="false" code="HBLNo">
                                <%# DataBinder.Eval(Container.DataItem, "HBLNo")%>
                            </td>
                            <td editable="false" code="InvoicesNoBuy">
                                <%# DataBinder.Eval(Container.DataItem, "InvoicesNoBuy")%>
                            </td>
                            <td editable="false" code="InvoicesDateBuy">
                                <%# DataBinder.Eval(Container.DataItem, "InvoicesDateBuy")%>
                            </td>
                            <td editable="false" code="Total_BuyPriceInvoice">
                                <%# DataBinder.Eval(Container.DataItem, "Total_BuyPriceInvoice")%>
                            </td>
                            <td editable="false" code="InvoicesNo">
                                <%# DataBinder.Eval(Container.DataItem, "InvoicesNo")%>
                            </td>
                            <td editable="false" code="InvoicesDate">
                                <%# DataBinder.Eval(Container.DataItem, "InvoicesDate")%>
                            </td>
                            <td editable="false" code="Total_SellPriceInvoice">
                                <%# DataBinder.Eval(Container.DataItem, "Total_SellPriceInvoice")%>
                            </td>
                            <td editable="false" code="COM">
                                <%# DataBinder.Eval(Container.DataItem, "COM")%>
                            </td>
                            <td editable="false" code="TB">
                                <%# DataBinder.Eval(Container.DataItem, "TB")%>
                            </td>
                            <td editable="false" code="Note">
                                <%# DataBinder.Eval(Container.DataItem, "Note")%>
                            </td>
                            <td>
                                <%# DataBinder.Eval(Container.DataItem, "Action")%>
                            </td>
                        </tr>
                    </ItemTemplate>
                    <HeaderTemplate>
                        <table cellspacing="0" cellpadding="0" width="100%" border="0" class="adminlist"
                            editcellcontent="true">
                            <thead>
                                <tr style="background: #ECECEC;">
                                    <th align="center" class="thheader" width="30px" rowspan="2">
                                        Index
                                    </th>
                                    <th align="center" class="thheader" rowspan="2">
                                        Số file
                                    </th>
                                    <th align="center" class="thheader" rowspan="2">
                                        Nhà CC
                                    </th>
                                    <th align="center" class="thheader" rowspan="2">
                                        Khách hàng
                                    </th>
                                    <%--<th align="center" class="thheader">
                                        POL
                                    </th>--%>
                                    <th align="center" class="thheader" rowspan="2">
                                        POD
                                    </th>
                                    <th align="center" class="thheader" rowspan="2">
                                        ATD
                                    </th>
                                    <th align="center" class="thheader" rowspan="2">
                                        M/BL NO
                                    </th>
                                    <th align="center" class="thheader" rowspan="2">
                                        H/BL NO
                                    </th>
                                    <th align="center" class="thheader" colspan="3">
                                        HĐ mua vào
                                    </th>
                                    <th align="center" class="thheader" colspan="3">
                                        HĐ bán ra
                                    </th>
                                    <th align="center" class="thheader" rowspan="2">
                                        COM
                                    </th>
                                    <th align="center" class="thheader" rowspan="2">
                                        TB
                                    </th>
                                    <th align="center" class="thheader" rowspan="2">
                                        Ghi chú
                                    </th>
                                    <th align="center" rowspan="2" class="thheader" style="min-width: 70px;">
                                        Action
                                    </th>
                                </tr>
                                <tr>
                                    <th align="center" class="thheader">
                                        Số hóa đơn
                                    </th>
                                    <th align="center" class="thheader">
                                        Ngày hóa đơn
                                    </th>
                                    <th align="center" class="thheader">
                                        Số tiền
                                    </th>
                                    <th align="center" class="thheader">
                                        Số hóa đơn
                                    </th>
                                    <th align="center" class="thheader">
                                        Ngày hóa đơn
                                    </th>
                                    <th align="center" class="thheader">
                                        Số tiền
                                    </th>
                                </tr>
                            </thead>
                    </HeaderTemplate>
                    <FooterTemplate>
                        <tr class="bottom">
                            <td colspan="8">
                                Tổng cộng
                            </td>
                            <td colspan="3">
                                <%=All_BuyPriceInvoice.ToString("0,0.##") %>
                            </td>
                            <td colspan="3">
                                <%=All_SellPriceInvoice.ToString("0,0.##") %>
                            </td>
                            <td>
                                <%=All_Com.ToString("0,0.##") %>
                            </td>
                            <td>
                                <%=All_Tb.ToString("0,0.##") %>
                            </td>
                            <td colspan="2">
                            </td>
                        </tr>
                        </TABLE>
                    </FooterTemplate>
                </asp:Repeater>
                <div class="clear">
                </div>
                <div id="footer">
                    <%=strPager%>
                </div>
                </form>
            </div>
        </div>
    </div>
</body>
</html>
